package com.jiyun.controller.goods;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jiyun.pojo.goods.CategoryReport;
import com.jiyun.service.goods.CategoryReportService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/categoryReport")
public class CategoryReportController {
    @Reference
    private CategoryReportService categoryReportService;

    /**
     * 昨天的数据统计
     *
     * @return
     */
    @GetMapping("/yesterday")
    public List<CategoryReport> yesterday() {
        LocalDate localDate = LocalDate.now().minusDays(1);// 得到昨天的日期
        return categoryReportService.categoryReport(localDate);
    }

     @GetMapping("/category1Count")
    public List<Map> category1Count(String date1, String date2){
        return categoryReportService.category1Count(date1,date2);
    }
}